Skip to content

Update vendored zlib to 1.3.2#1443

Merged
bmehta001 merged 2 commits into
microsoft:mainfrom
bmehta001:bhamehta/update-zlib-132
May 22, 2026
Merged

Update vendored zlib to 1.3.2#1443
bmehta001 merged 2 commits into
microsoft:mainfrom
bmehta001:bhamehta/update-zlib-132

Conversation

@bmehta001
Copy link
Copy Markdown
Contributor

@bmehta001 bmehta001 commented May 20, 2026

Summary

  • Refresh vendored zlib sources, headers, docs, and minizip files to upstream v1.3.2 (da607da739fa6047df13e66a2af6b8bec7c2a498).
  • Update CGManifest to point at the upstream v1.3.2 commit
  • Keep zlib/ closer to the upstream layout while preserving the repo-specific integrations that are still required:
    • Move the repo-owned Visual Studio zlib project wiring out of zlib/contrib/vstudio/vc14 and into third_party/Solutions/zlib/vc14, then update the solution, SDK project, sample, and test references to the new location. Upstream zlib 1.3.2 removed the pre-made Visual Studio project directories, but this repo still builds zlib through the legacy zlibvc.vcxproj path from Solutions/MSTelemetrySDK.sln, SDK projects, samples, and tests.
    • Remove the unused legacy zlib/contrib/vstudio/vc9, vc10, and vc11 directories from the vendored zlib tree.
    • Keep the SDK's act_z_ symbol-prefix shim through zlib/names.h and the #include "names.h" hooks in zconf.h, zconf.h.in, and zconf.h.cmakein. This still needs to be visible from zlib's public/config headers while the repo uses a prefixed vendored zlib.
    • Keep the repo-specific gzgetc prefix handling in gzread.c / zlib.h; this remains tied to the custom act_z_ prefix map because using upstream's Z_PREFIX_SET path directly would break zlib's deflateInit / inflateInit macro behavior for this repo's prefix scheme.
    • Fix the zlib CMake shim so out-of-source builds do not rename zconf.h and non-Windows builds do not get Windows-only macros.

Refresh vendored zlib sources, headers, documentation, and minizip files to upstream v1.3.2 so the SDK tracks the current supported zlib release.

Preserve the SDK's symbol-prefix shim and legacy Windows project wiring, and update the zlib CMake shim so out-of-source builds no longer mutate zconf.h or define Windows macros on non-Windows hosts.

Files changed:

- cgmanifest.json

- zlib core sources, headers, docs, and minizip support files

- zlib/names.h and zlib/CMakeLists.txt repo-specific shims

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bmehta001 bmehta001 requested a review from a team as a code owner May 20, 2026 22:07
@bmehta001 bmehta001 self-assigned this May 21, 2026
@bmehta001 bmehta001 requested a review from Copilot May 21, 2026 00:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review this pull request because it exceeds the maximum number of lines (20,000). Try reducing the number of changed lines and requesting a review from Copilot again.

@pablo-msft
Copy link
Copy Markdown
Contributor

Preserve repo-specific zlib integration instead of doing a pure upstream folder replacement:

  • Keep the existing zlib/contrib/vstudio/vc9, vc10, vc11, and vc14 project directories. Upstream zlib 1.3.2 removed these, but this repo still builds zlib through zlib/contrib/vstudio/vc14/zlibvc.vcxproj from Solutions/MSTelemetrySDK.sln, SDK projects, samples, and tests.
  • Keep the SDK's act_z_ symbol-prefix shim through zlib/names.h and the #include "names.h" hooks in zconf.h, zconf.h.in, and zconf.h.cmakein.
  • Keep the repo-specific gzgetc prefix handling in gzread.c / zlib.h.

Is it possible to move some (or all) of these to somewhere outside of zlib? For example, the vcxproj could move to third_party/Solutions/zlib (lining up with my hope of moving zlib itself to third_party/zlib) -- that would make it clear what the changes are. Very similar to the PR you just did regarding resetting zlib to a clean copy.

Keep the vendored zlib folder closer to the upstream 1.3.2 layout while preserving the legacy MSBuild project used by the Windows solution.

Files changed:

- Move vc14 zlib Visual Studio projects to third_party/Solutions/zlib/vc14

- Update solution, sample, and test ProjectReference paths

- Remove unused vc9/vc10/vc11 zlib project directories

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bmehta001
Copy link
Copy Markdown
Contributor Author

Done in 7f2331fc. I moved the repo-owned Visual Studio zlib project wiring out of zlib/contrib/vstudio/vc14 to third_party/Solutions/zlib/vc14, updated the solution/project references, and removed the unused vc9, vc10, and vc11 project directories from the vendored zlib tree.

I also checked whether the prefix shim could move out cleanly. I kept names.h / the small gzgetc handling in zlib for now because the act_z_ map has to be visible through zlib's config/public headers, and treating it as upstream Z_PREFIX_SET would break zlib's deflateInit / inflateInit macro behavior for this repo's prefix scheme.

<ClInclude Include="..\..\..\zlib.h" />
<ClInclude Include="..\..\..\zutil.h" />
<ClInclude Include="..\..\..\..\zlib\deflate.h" />
<ClInclude Include="..\..\..\..\zlib\infblock.h" />
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: these headers infblock.h / infcodes.h / infutil.h are stale entries. These already existed before this move, so I do not think this is a regression. They should only matter if something actually tries to include/use those headers. Longer term, as we move away from carrying a repo-owned zlib snapshot, we should clean up this kind of stale project wiring too. No action needed as of now, just flagging it for now.

Copy link
Copy Markdown
Contributor

@lalitb lalitb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice work.

One observation - I noticed our internal vcpkg port may drift from this zlib update because it has its own pinned source and patch. I think the vcpkg port is already stale in lots of areas, so worth keeping in mind for later cleanup if we continue to carry that port.

@bmehta001 bmehta001 merged commit de38c4b into microsoft:main May 22, 2026
26 of 27 checks passed
@bmehta001 bmehta001 deleted the bhamehta/update-zlib-132 branch May 22, 2026 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants